Wiki-Vote Experiments Output Visualization


In [1]:
#!/usr/bin/python
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from stats import parse_results, get_percentage, get_avg_per_seed, draw_pie, draw_bars, draw_bars_comparison, draw_avgs

Parse results


In [2]:
pr, eigen, bet = parse_results('test_wikivote.txt')

PageRank Seeds Percentage

How many times the "Top X" nodes from PageRank have led to the max infection


In [3]:
draw_pie(get_percentage(pr))


Avg adopters per seed comparison


In [4]:
draw_bars_comparison('Avg adopters per seeds', 'Avg adopters', np.array(get_avg_per_seed(pr)+[(0, np.mean(pr[:,1]))]))


Eigenvector Seeds Percentage

How many times the "Top X" nodes from Eigenvector have led to the max infection


In [5]:
draw_pie(get_percentage(eigen))


Avg adopters per seed comparison


In [6]:
draw_bars_comparison('Avg adopters per seeds', 'Avg adopters', np.array(get_avg_per_seed(eigen)+[(0, np.mean(eigen[:,1]))]))


Betweenness Seeds Percentage

How many times the "Top X" nodes from Betweenness have led to the max infection


In [7]:
draw_pie(get_percentage(bet))


Avg adopters per seed comparison


In [8]:
draw_bars_comparison('Avg adopters per seeds', 'Avg adopters', np.array(get_avg_per_seed(bet)+[(0, np.mean(bet[:,1]))]))


100 runs adopters comparison


In [9]:
draw_bars(np.sort(pr.view('i8,i8'), order=['f0'], axis=0).view(np.int),
         np.sort(eigen.view('i8,i8'), order=['f0'], axis=0).view(np.int),
         np.sort(bet.view('i8,i8'), order=['f0'], axis=0).view(np.int))


Centrality Measures Averages

PageRank avg adopters and seed


In [10]:
pr_mean = np.mean(pr[:,1])
pr_mean_seed = np.mean(pr[:,0])
print 'Avg Seed:',pr_mean_seed, 'Avg adopters:', pr_mean


Avg Seed: 98.45 Avg adopters: 266.23

Eigenv avg adopters and seed


In [11]:
eigen_mean = np.mean(eigen[:,1])
eigen_mean_seed = np.mean(eigen[:,0])
print 'Avg Seed:',eigen_mean_seed, 'Avg adopters:',eigen_mean


Avg Seed: 98.55 Avg adopters: 601.71

Betweenness avg adopters and seed


In [12]:
bet_mean = np.mean(bet[:,1])
bet_mean_seed = np.mean(bet[:,0])
print 'Avg Seed:',bet_mean_seed, 'Avg adopters:',bet_mean


Avg Seed: 97.8 Avg adopters: 477.93

In [13]:
draw_avgs([pr_mean, eigen_mean, bet_mean])